package fr.upmc.alasca.centreCalcul.interne.controleurApplication.ports;

import java.util.List;
import java.util.Map;

import fr.upmc.alasca.centreCalcul.interne.controleurApplication.ControleurApplication;
import fr.upmc.alasca.centreCalcul.interne.controleurApplication.interfaces.ControleurApplicationCapteurTEI;
import fr.upmc.alasca.centreCalcul.objets.Requete;
import fr.upmc.components.ComponentI.ComponentService;
import fr.upmc.components.ports.AbstractInboundPort;

public class ControleurApplicationCapteurTEInboundPort 
extends			AbstractInboundPort
implements		ControleurApplicationCapteurTEI
{
	private static final long serialVersionUID = 1L;
	
	
	public	ControleurApplicationCapteurTEInboundPort 
	(
		String		p_uri,
		ControleurApplication	p_owner
	) throws	Exception
	{
		super(p_uri, ControleurApplicationCapteurTEI.class, p_owner);
		
		assert this.uri != null;
	}


	@Override
	public void getMesureCapteurTE(Map<String, List<Requete>> stockageRequete) throws Exception {
		((ControleurApplication) this.owner).recupererMesureCapteur(stockageRequete);
		
	}


	@Override
	public void arreterApplication() throws Exception {
		final ControleurApplication ca = (ControleurApplication) this.owner;
		
		ca.handleRequestAsync(new ComponentService<Void>() {
				@Override
				public Void call() throws Exception {
					 ca.arreterApplication();
					 return null;
				}
			});
	}


	@Override
	public void callbackAjouterCoeurs(List<String> listMP) throws Exception {
		((ControleurApplication) this.owner).callbackAjouterCoeurs(listMP);
		
	}

}
